﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using Excel = Microsoft.Office.Interop.Excel;// using Excel

namespace Excel1316AddIn01
{
    // ZC：貌似 一个 vsto只能有一个Ribbon1显示出来。
    // ZC: 如果要显示RibbonC7的话，就把本类全部注释掉，再将Ribbon1.Designer.cs中的InitializeComponent()函数内容全部注释掉
    public partial class Ribbon1
    {
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {

        }

        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            Excel.Range rng;// 声明一个Excel的单元格区域变量
            rng = Globals.ThisAddIn.Application.Selection;// 获得Excel所选区域
            rng.Interior.Color = System.Drawing.Color.Yellow;// 设置所选区域底纹颜色为黄色
        }

        private void group1_DialogLauncherClick(object sender, RibbonControlEventArgs e)
        {
            Form1 fm1 = new Form1();// 创建新实例
            //fm1.ShowDialog();
            fm1.Show();
        }
    }
}
